package com.sanyang.pda.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sanyang.pda.bean.OutWarehousingBean;
import com.sanyang.pda.utils.Utils;
import com.wangshen.base.ui.mvp.base.adapter.BaseAdapter;
import com.wangshen.projectbase.R;

import java.util.List;

public class ManualOutWarehousingAdapter extends BaseAdapter<OutWarehousingBean> {
    public ManualOutWarehousingAdapter(int layoutResId, @Nullable List<OutWarehousingBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OutWarehousingBean item) {
        super.convert(helper, item);
        helper.setText(R.id.tv_title,item.getArticleName());
        helper.setText(R.id.tv_goods_code,item.getArticleId());
        helper.setText(R.id.tv_good_spec,item.getSpec());

        helper.setText(R.id.tv_amount, (item.getNum()/item.getPackNum())+Utils.getPackUnit(getContext(),item.getPackUnit())+(item.getNum()%item.getPackNum())+Utils.getArticleUnit(getContext(),item.getArticleUnit()));
        if (item.getStatus() == 20){
            helper.setText(R.id.tv_state,getContext().getResources().getString(R.string.have_outbound));
        }else {
            helper.setText(R.id.tv_state,getContext().getResources().getString(R.string.for_outbound));
        }
    }
}
